//
//  RootSuperAction.m
//  HiCar
//
//  Created by huachun on 2018/12/24.
//  Copyright © 2018 丁一. All rights reserved.
//

#import "RootSuperAction.h"
#import "LoginController.h"
#import "HiWebController.h"

@implementation RootSuperAction

+(RootSuperAction *)Actiontodone:(SuperActionType)actiontype view:(id)view dictionary:(NSDictionary *)dictionary{
    RootSuperAction *action=[[RootSuperAction alloc] init:actiontype view:view dictionary:dictionary];
    return action;
}

-(instancetype)init:(SuperActionType)actiontype view:(id)view dictionary:(NSDictionary *)dictionary{
    self=[super init];
    if (self) {
        
        self.view = (UIViewController *)view;
        
        if (actiontype==JonesGOTO_Login) {
            
            LoginController *login = [LoginController new];
            login.hidesBottomBarWhenPushed = YES;
            [self.view.navigationController pushViewController:login animated:YES];
            
        } else if (actiontype == JonesGOTO_Web){
            HiWebController *webvc=[HiWebController new];
            webvc.Url_string = [dictionary objectForKey:@"url"];
            [self.view.navigationController pushViewController:webvc animated:YES];
        }
        else if (actiontype == JonesGOTO_User_Xie_yi){
            [DEFAULTS setObject:[dictionary objectForKey:@"url"] forKey:@"UserChendGeNgFanc"];
        }
//        else if (actiontype == HiChange_Tabbar){
//
//            AppDelegate *app = (AppDelegate *)[UIApplication sharedApplication].delegate;
//            UIViewController *vc = app.window.rootViewController;
//
//            app.window.rootViewController = (UIViewController *)app.Root_VC;
//
//            [vc removeFromParentViewController];
//
//        }
        
    }
    return self;
}

@end
